HA$PBExportHeader$w_help_nrodocuvta.srw
forward
global type w_help_nrodocuvta from window
end type
type st_1 from statictext within w_help_nrodocuvta
end type
type st_2 from statictext within w_help_nrodocuvta
end type
type uo_busca from uo_busca_clientes within w_help_nrodocuvta
end type
type cb_seleccionar from commandbutton within w_help_nrodocuvta
end type
type cb_salir from commandbutton within w_help_nrodocuvta
end type
type dw_lclie from datawindow within w_help_nrodocuvta
end type
end forward

global type w_help_nrodocuvta from window
integer width = 2098
integer height = 1252
boolean titlebar = true
string title = "Correlativos de Documentos de Venta"
boolean controlmenu = true
windowtype windowtype = response!
long backcolor = 67108864
string icon = "C:\MisSistemas\Summapro\huron.ico"
boolean center = true
event type boolean ue_retrieve ( )
event ue_post_data ( )
st_1 st_1
st_2 st_2
uo_busca uo_busca
cb_seleccionar cb_seleccionar
cb_salir cb_salir
dw_lclie dw_lclie
end type
global w_help_nrodocuvta w_help_nrodocuvta

type variables
string is_codig,is_perfi
int ii_fila_elegida

s_parm istr_parm
BOOLEAN ib_Indicador_Cierre = false 
end variables

event ue_post_data();uo_busca.sle_texto.text =istr_parm.string_parm[1]
end event

on w_help_nrodocuvta.create
this.st_1=create st_1
this.st_2=create st_2
this.uo_busca=create uo_busca
this.cb_seleccionar=create cb_seleccionar
this.cb_salir=create cb_salir
this.dw_lclie=create dw_lclie
this.Control[]={this.st_1,&
this.st_2,&
this.uo_busca,&
this.cb_seleccionar,&
this.cb_salir,&
this.dw_lclie}
end on

on w_help_nrodocuvta.destroy
destroy(this.st_1)
destroy(this.st_2)
destroy(this.uo_busca)
destroy(this.cb_seleccionar)
destroy(this.cb_salir)
destroy(this.dw_lclie)
end on

event open;/* Script de inicio ventana w_seleclie
$$HEX36$$af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af002000$$ENDHEX$$by ISIA (c) 2009
	Objeto: w_seleclie
	Evento: open()
	Work: Cargas los datos en el datawindow
	Call: 1) Desde w_fichas_clientes bot$$HEX1$$f300$$ENDHEX$$n "B$$HEX1$$fa00$$ENDHEX$$squeda Interactiva"
		   2) Desde Facturaci$$HEX1$$f300$$ENDHEX$$n y Remitos
*/
//Traigo los datos

istr_parm=message.powerobjectparm
istr_parm.char_parm[1]='0'

//dw_lclie.dataobject='d_usp_listapreciouser_grid_load'

dw_lclie.settransobject(sqlca)
//dw_lclie.retrieve(gs_iduser,istr_parm.integer_parm[2],istr_parm.integer_parm[3])
dw_lclie.retrieve()
//@iduser nvarchar(50),@lista int,@idTipoItem int ,@idalma int

//Le doy el foco por si trabaja m$$HEX1$$e100$$ENDHEX$$s con el teclado
//dw_lclie.setfocus()

uo_busca.sle_texto.setfocus()

post event ue_post_data()
end event

type st_1 from statictext within w_help_nrodocuvta
boolean visible = false
integer x = 2245
integer y = 548
integer width = 1303
integer height = 52
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
long textcolor = 32768
long backcolor = 67108864
string text = "Click en el t$$HEX1$$ed00$$ENDHEX$$tulo de la columna define b$$HEX1$$fa00$$ENDHEX$$squeda interactiva."
boolean focusrectangle = false
end type

type st_2 from statictext within w_help_nrodocuvta
boolean visible = false
integer x = 2235
integer y = 472
integer width = 1792
integer height = 80
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
long textcolor = 32768
long backcolor = 67108864
string text = "Doble click en la celda selecciona."
boolean focusrectangle = false
end type

type uo_busca from uo_busca_clientes within w_help_nrodocuvta
integer x = 9
integer y = 12
integer taborder = 10
end type

on uo_busca.destroy
call uo_busca_clientes::destroy
end on

event constructor;call super::constructor;//por default configuro la columna y el label de la columna inicial
//y tambien el datawindow a ser filtrado
dw = dw_lclie
columna = 'tdocumento'
columna_label = 'Correlativo'
end event

type cb_seleccionar from commandbutton within w_help_nrodocuvta
integer x = 1687
integer y = 244
integer width = 402
integer height = 112
integer taborder = 30
integer textsize = -10
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
string text = "Seleccionar"
boolean default = true
end type

event clicked;/* Script para el bot$$HEX1$$f300$$ENDHEX$$n seleccionar fila
$$HEX36$$af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af002000$$ENDHEX$$by ISIA (c) 2009
	Objeto: w_seleclie --> cb_seleccionar
	Evento: clicked()
	Work: selecciona la resaltada
	Call: w_seleclie -> cb_seleccionar
*/
// Me devuelve el n$$HEX1$$fa00$$ENDHEX$$mero de fila que eleg$$HEX1$$ed00$$ENDHEX$$
ii_fila_elegida=dw_lclie.getrow()
istr_parm.string_parm[1] =dw_lclie.object.tdocumento[ii_fila_elegida]
istr_parm.integer_parm[1] =dw_lclie.object.iddocu[ii_fila_elegida]
istr_parm.integer_parm[2] =dw_lclie.object.iddocumento[ii_fila_elegida]
//istr_parm.double_parm[1] =dw_lclie.object.nprecioventa[ii_fila_elegida]
//
//
//istr_parm.double_parm[2] =dw_lclie.object.nstock[ii_fila_elegida]
//istr_parm.string_parm[10] =dw_lclie.object.idunid[ii_fila_elegida]
//
//istr_parm.double_parm[3] =dw_lclie.object.nporc1[ii_fila_elegida] //PORCENTAJE

istr_parm.char_parm[1] = '1'
// Abro la Ficha del Cliente y env$$HEX1$$ed00$$ENDHEX$$o el par$$HEX1$$e100$$ENDHEX$$metro
closewithreturn(parent,istr_parm)


end event

type cb_salir from commandbutton within w_help_nrodocuvta
integer x = 1687
integer y = 376
integer width = 402
integer height = 112
integer taborder = 40
integer textsize = -10
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
string text = "Salir"
boolean cancel = true
end type

event clicked;close(parent)
end event

type dw_lclie from datawindow within w_help_nrodocuvta
integer x = 18
integer y = 244
integer width = 1627
integer height = 912
integer taborder = 20
string title = "none"
string dataobject = "d_vtadocu_despacho_grid"
boolean hscrollbar = true
boolean vscrollbar = true
boolean livescroll = true
end type

event clicked;/*Aqui al dar cliked en la cabecera de la columna se configura para filtar 
  el nombre dela label debe ser llamado nombre del campo + '_t' como define PB
Ejemplo  nombre  - > Label o cabecera nombre  */
  
  
string ls_columna
ls_columna = string(dwo.name)
if right(ls_columna,2) = '_t' then
	ls_columna = left(ls_columna, len(ls_columna)-2)
	ls_columna = ls_columna+' A'
	dw_lclie.setsort(ls_columna)
	dw_lclie.sort()
end if

  
if row = 0  then
	 if dwo.name = 'datawindow' then return
//	 string ls_columna
	 ls_columna = mid(string(dwo.name),1,len(string(dwo.name))-2)
		
	 uo_busca.columna_label = dwo.text
	 uo_busca.columna = ls_columna
	 //uo_busca.wf_sort()
	 uo_busca.wf_poner_titulo()
	 uo_busca.setfocus()
end if	
end event

event rowfocuschanged;/* Script para la b$$HEX1$$fa00$$ENDHEX$$squeda interactiva
$$HEX32$$af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af002000$$ENDHEX$$by ISIA (c) 2009
	Objeto: w_seleclie --> uo_busca
	Evento: rowfocuschanged()
	Work: Va seleccionando la fila a medida que escribo
	Call: Desde uo_busca
*/
dw_lclie.SelectRow(0,false)
dw_lclie.SelectRow(currentrow,true)
//dw_lclie.scrolltorow(currentrow)
//dw_lclie.setrow(currentrow)
end event

event doubleclicked;/* Script seleccionar con doble click sobre la fila 
$$HEX36$$af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af00af002000$$ENDHEX$$by ISIA (c) 2009
	Objeto: w_seleclie
	Evento: doubleclicked()
	Work: Carga la fila seleccionada y la envia en par$$HEX1$$e100$$ENDHEX$$metro de retorno
	Call: Desde dw_lclie en w_seleclie con doble click del mouse
*/

string ls_columna
ls_columna = string(dwo.name)
if right(ls_columna,2) = '_t' then
	ls_columna = left(ls_columna, len(ls_columna)-2)
	ls_columna = ls_columna+' D'
	dw_lclie.setsort(ls_columna)
	dw_lclie.sort()
	return
end if

ii_fila_elegida=dw_lclie.getrow()
istr_parm.string_parm[1] =dw_lclie.object.tdocumento[ii_fila_elegida]
istr_parm.integer_parm[1] =dw_lclie.object.iddocu[ii_fila_elegida]
istr_parm.integer_parm[2] =dw_lclie.object.iddocumento[ii_fila_elegida]
//istr_parm.double_parm[1] =dw_lclie.object.nprecioventa[ii_fila_elegida]
//istr_parm.double_parm[2] =dw_lclie.object.nstock[ii_fila_elegida]
//istr_parm.string_parm[10] =dw_lclie.object.idunid[ii_fila_elegida]
//
//istr_parm.double_parm[3] =dw_lclie.object.nporc1[ii_fila_elegida] //PORCENTAJE

istr_parm.char_parm[1] = '1'
//Abro la Ficha del Cliente
closewithreturn(parent,istr_parm)


end event

